package com.xr.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.xr.pojo.Goods;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import java.util.List;

@SpringBootTest
public class GoodsServiceTest {

    @Autowired
    private GoodsService goodsService;

    @Test
    void testGetById(){
        System.out.println(goodsService.getById(4));
    }
    @Test
    void testSave(){
        Goods goods = new Goods();
        goods.setInfo("测试数据123");
        goods.setName("测试数据123");
        goods.setPrice(11);
        goodsService.save(goods);
    }
    @Test
    void testUpdate(){
        Goods goods = new Goods();
        goods.setId(12);
        goods.setInfo("-----------------");
        goods.setName("测试数据123");
        goods.setPrice(11);
        goodsService.update(goods);
    }
    @Test
    void testDelete() {
        goodsService.delete(12);
    }
    @Test
    void testGetAll(){
        List<Goods> goods = goodsService.getAll();
        System.out.println(goods);
    }
//    @Test
//    void testGetPage(){
////        IPage<Goods> page = goodsService.getPage(2,5);
//        System.out.println(page.getCurrent());
//        System.out.println(page.getSize());
//        System.out.println(page.getTotal());
//        System.out.println(page.getPages());
//        System.out.println(page.getRecords());
//    }

}
